package com.happy.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.happy.entity.NoteEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: Wuzh
 * @Description:
 * @Date Created in 21:47 2021/1/27
 * @return
 */

@Mapper
public interface NoteMapper extends BaseMapper<NoteEntity> {


    @Select (value = "select ni.id,\n" +
            "       ni.noteTitle,\n" +
            "       ni.level,\n" +
            "       ni.noteContent,\n" +
            "       ni.categoryId,\n" +
            "       ni.createTime,\n" +
            "       ni.changeTime,\n" +
            "       ni.isUsed,\n" +
            "       fi.fileUrl\n" +
            "from note_info ni\n" +
            "         left join file_info fi on ni.id = fi.relationId and fi.type=#{type}")
    List<NoteEntity> queryList (@Param ("type") int type);

}
